

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>部署个全新的 Ceph 集群 &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/custom.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../_static/favicon.ico"/>
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/jquery.js"></script>
        <script src="../../_static/underscore.js"></script>
        <script src="../../_static/doctools.js"></script>
    
    <script type="text/javascript" src="../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../genindex/" />
    <link rel="search" title="Search" href="../../search/" />
    <link rel="next" title="现有集群切换到 cephadm" href="../adoption/" />
    <link rel="prev" title="Compatibility and Stability" href="../compatibility/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../" class="icon icon-home"></a> &raquo;</li>
        
          <li><a href="../">Cephadm</a> &raquo;</li>
        
      <li>部署个全新的 Ceph 集群</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../../_sources/cephadm/install.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../">
          

          
            
            <img src="../../_static/logo.png" class="logo" alt="Logo"/>
          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../start/intro/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../install/">安装 Ceph</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../">Cephadm</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../compatibility/">Compatibility and Stability</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">部署个全新的 Ceph 集群</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#cephadm-host-requirements">准备事项</a></li>
<li class="toctree-l3"><a class="reference internal" href="#cephadm">安装 cephadm</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#curl-based-installation">curl-based installation</a></li>
<li class="toctree-l4"><a class="reference internal" href="#distribution-specific-installations">distribution-specific installations</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#bootstrap-a-new-cluster">Bootstrap a new cluster</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#what-to-know-before-you-bootstrap">What to know before you bootstrap</a></li>
<li class="toctree-l4"><a class="reference internal" href="#running-the-bootstrap-command">Running the bootstrap command</a></li>
<li class="toctree-l4"><a class="reference internal" href="#further-information-about-cephadm-bootstrap">Further information about cephadm bootstrap</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#different-deployment-scenarios">Different deployment scenarios</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#single-host">Single host</a></li>
<li class="toctree-l4"><a class="reference internal" href="#deployment-in-an-isolated-environment">Deployment in an isolated environment</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#enable-ceph-cli">Enable Ceph CLI</a></li>
<li class="toctree-l3"><a class="reference internal" href="#adding-hosts">Adding Hosts</a></li>
<li class="toctree-l3"><a class="reference internal" href="#adding-additional-mons">Adding additional MONs</a></li>
<li class="toctree-l3"><a class="reference internal" href="#adding-storage">Adding Storage</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#enabling-osd-memory-autotuning">Enabling OSD memory autotuning</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#using-ceph">Using Ceph</a></li>
<li class="toctree-l3"><a class="reference internal" href="#cephadm-deployment-scenarios">Different deployment scenarios</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#id3">Single host</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id4">Deployment in an isolated environment</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../adoption/">现有集群切换到 cephadm</a></li>
<li class="toctree-l2"><a class="reference internal" href="../host-management/">Host Management</a></li>
<li class="toctree-l2"><a class="reference internal" href="../services/">Service Management</a></li>
<li class="toctree-l2"><a class="reference internal" href="../upgrade/">Ceph 的升级</a></li>
<li class="toctree-l2"><a class="reference internal" href="../operations/">Cephadm operations</a></li>
<li class="toctree-l2"><a class="reference internal" href="../client-setup/">Client Setup</a></li>
<li class="toctree-l2"><a class="reference internal" href="../troubleshooting/">Troubleshooting</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../dev/cephadm/">Cephadm Feature Planning</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <div class="section" id="ceph">
<h1>部署个全新的 Ceph 集群<a class="headerlink" href="#ceph" title="Permalink to this headline">¶</a></h1>
<p>Cephadm creates a new Ceph cluster by “bootstrapping” on a single
host, expanding the cluster to encompass any additional hosts, and
then deploying the needed services.</p>
<div class="section" id="cephadm-host-requirements">
<span id="id1"></span><h2>准备事项<a class="headerlink" href="#cephadm-host-requirements" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li><p>Python 3</p></li>
<li><p>Systemd</p></li>
<li><p>Podman or Docker for running containers</p></li>
<li><p>Time synchronization (such as chrony or NTP)</p></li>
<li><p>LVM2 for provisioning storage devices</p></li>
</ul>
<p>Any modern Linux distribution should be sufficient.  Dependencies
are installed automatically by the bootstrap process below.</p>
<p>See the section <a class="reference internal" href="../compatibility/#cephadm-compatibility-with-podman"><span class="std std-ref">Compatibility With Podman
Versions</span></a> for a table of Ceph versions that
are compatible with Podman. Not every version of Podman is compatible with
Ceph.</p>
</div>
<div class="section" id="cephadm">
<span id="get-cephadm"></span><h2>安装 cephadm<a class="headerlink" href="#cephadm" title="Permalink to this headline">¶</a></h2>
<p><code class="docutils literal notranslate"><span class="pre">cephadm</span></code> 命令可以</p>
<ol class="arabic simple">
<li><p>bootstrap a new cluster</p></li>
<li><p>launch a containerized shell with a working Ceph CLI</p></li>
<li><p>aid in debugging containerized Ceph daemons</p></li>
</ol>
<p>There are two ways to install <code class="docutils literal notranslate"><span class="pre">cephadm</span></code>:</p>
<ol class="arabic simple">
<li><p>a <a class="reference internal" href="#cephadm-install-curl"><span class="std std-ref">curl-based installation</span></a> method</p></li>
<li><p><a class="reference internal" href="#cephadm-install-distros"><span class="std std-ref">distribution-specific installation methods</span></a></p></li>
</ol>
<div class="section" id="curl-based-installation">
<span id="cephadm-install-curl"></span><h3>curl-based installation<a class="headerlink" href="#curl-based-installation" title="Permalink to this headline">¶</a></h3>
<ul>
<li><p>Use <code class="docutils literal notranslate"><span class="pre">curl</span></code> to fetch the most recent version of the
standalone script.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><style type="text/css">
span.prompt1:before {
  content: "# ";
}
</style><span class="prompt1">curl --silent --remote-name --location https://github.com/ceph/ceph/raw/pacific/src/cephadm/cephadm</span>
</pre></div></div><p>Make the <code class="docutils literal notranslate"><span class="pre">cephadm</span></code> script executable:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">chmod +x cephadm</span>
</pre></div></div><p>This script can be run directly from the current directory:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">./cephadm &lt;arguments...&gt;</span>
</pre></div></div></li>
<li><p>Although the standalone script is sufficient to get a cluster started, it is
convenient to have the <code class="docutils literal notranslate"><span class="pre">cephadm</span></code> command installed on the host.  To install
the packages that provide the <code class="docutils literal notranslate"><span class="pre">cephadm</span></code> command, run the following
commands:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">./cephadm add-repo --release pacific</span>
<span class="prompt1">./cephadm install</span>
</pre></div></div><p>Confirm that <code class="docutils literal notranslate"><span class="pre">cephadm</span></code> is now in your PATH by running <code class="docutils literal notranslate"><span class="pre">which</span></code>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">which cephadm</span>
</pre></div></div><p>A successful <code class="docutils literal notranslate"><span class="pre">which</span> <span class="pre">cephadm</span></code> command will return this:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>/usr/sbin/cephadm
</pre></div>
</div>
</li>
</ul>
</div>
<div class="section" id="distribution-specific-installations">
<span id="cephadm-install-distros"></span><h3>distribution-specific installations<a class="headerlink" href="#distribution-specific-installations" title="Permalink to this headline">¶</a></h3>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>The methods of installing <code class="docutils literal notranslate"><span class="pre">cephadm</span></code> in this section are distinct from the curl-based method above. Use either the curl-based method above or one of the methods in this section, but not both the curl-based method and one of these.</p>
</div>
<p>Some Linux distributions  may already include up-to-date Ceph packages.  In
that case, you can install cephadm directly. For example:</p>
<blockquote>
<div><p>In Ubuntu:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">apt install -y cephadm</span>
</pre></div></div><p>In Fedora:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">dnf -y install cephadm</span>
</pre></div></div><p>In SUSE:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">zypper install -y cephadm</span>
</pre></div></div></div></blockquote>
</div>
</div>
<div class="section" id="bootstrap-a-new-cluster">
<h2>Bootstrap a new cluster<a class="headerlink" href="#bootstrap-a-new-cluster" title="Permalink to this headline">¶</a></h2>
<div class="section" id="what-to-know-before-you-bootstrap">
<h3>What to know before you bootstrap<a class="headerlink" href="#what-to-know-before-you-bootstrap" title="Permalink to this headline">¶</a></h3>
<p>The first step in creating a new Ceph cluster is running the <code class="docutils literal notranslate"><span class="pre">cephadm</span>
<span class="pre">bootstrap</span></code> command on the Ceph cluster’s first host. The act of running the
<code class="docutils literal notranslate"><span class="pre">cephadm</span> <span class="pre">bootstrap</span></code> command on the Ceph cluster’s first host creates the Ceph
cluster’s first “monitor daemon”, and that monitor daemon needs an IP address.
You must pass the IP address of the Ceph cluster’s first host to the <code class="docutils literal notranslate"><span class="pre">ceph</span>
<span class="pre">bootstrap</span></code> command, so you’ll need to know the IP address of that host.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>If there are multiple networks and interfaces, be sure to choose one
that will be accessible by any host accessing the Ceph cluster.</p>
</div>
</div>
<div class="section" id="running-the-bootstrap-command">
<h3>Running the bootstrap command<a class="headerlink" href="#running-the-bootstrap-command" title="Permalink to this headline">¶</a></h3>
<p>Run the <code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">bootstrap</span></code> command:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">cephadm bootstrap --mon-ip *&lt;mon-ip&gt;*</span>
</pre></div></div><p>This command will:</p>
<ul class="simple">
<li><p>Create a monitor and manager daemon for the new cluster on the local
host.</p></li>
<li><p>Generate a new SSH key for the Ceph cluster and add it to the root
user’s <code class="docutils literal notranslate"><span class="pre">/root/.ssh/authorized_keys</span></code> file.</p></li>
<li><p>Write a copy of the public key to <code class="docutils literal notranslate"><span class="pre">/etc/ceph/ceph.pub</span></code>.</p></li>
<li><p>Write a minimal configuration file to <code class="docutils literal notranslate"><span class="pre">/etc/ceph/ceph.conf</span></code>. This
file is needed to communicate with the new cluster.</p></li>
<li><p>Write a copy of the <code class="docutils literal notranslate"><span class="pre">client.admin</span></code> administrative (privileged!)
secret key to <code class="docutils literal notranslate"><span class="pre">/etc/ceph/ceph.client.admin.keyring</span></code>.</p></li>
<li><p>Add the <code class="docutils literal notranslate"><span class="pre">_admin</span></code> label to the bootstrap host.  By default, any host
with this label will (also) get a copy of <code class="docutils literal notranslate"><span class="pre">/etc/ceph/ceph.conf</span></code> and
<code class="docutils literal notranslate"><span class="pre">/etc/ceph/ceph.client.admin.keyring</span></code>.</p></li>
</ul>
</div>
<div class="section" id="further-information-about-cephadm-bootstrap">
<h3>Further information about cephadm bootstrap<a class="headerlink" href="#further-information-about-cephadm-bootstrap" title="Permalink to this headline">¶</a></h3>
<p>The default bootstrap behavior will work for most users. But if you’d like
immediately to know more about <code class="docutils literal notranslate"><span class="pre">cephadm</span> <span class="pre">bootstrap</span></code>, read the list below.</p>
<p>Also, you can run <code class="docutils literal notranslate"><span class="pre">cephadm</span> <span class="pre">bootstrap</span> <span class="pre">-h</span></code> to see all of <code class="docutils literal notranslate"><span class="pre">cephadm</span></code>’s
available options.</p>
<ul>
<li><p>By default, Ceph daemons send their log output to stdout/stderr, which is picked
up by the container runtime (docker or podman) and (on most systems) sent to
journald.  If you want Ceph to write traditional log files to <code class="docutils literal notranslate"><span class="pre">/var/log/ceph/$fsid</span></code>,
use the <code class="docutils literal notranslate"><span class="pre">--log-to-file</span></code> option during bootstrap.</p></li>
<li><p>Larger Ceph clusters perform better when (external to the Ceph cluster)
public network traffic is separated from (internal to the Ceph cluster)
cluster traffic. The internal cluster traffic handles replication, recovery,
and heartbeats between OSD daemons.  You can define the <a class="reference internal" href="../../rados/configuration/network-config-ref/#cluster-network"><span class="std std-ref">cluster
network</span></a> by supplying the <code class="docutils literal notranslate"><span class="pre">--cluster-network</span></code> option to the <code class="docutils literal notranslate"><span class="pre">bootstrap</span></code>
subcommand. This parameter must define a subnet in CIDR notation (for example
<code class="docutils literal notranslate"><span class="pre">10.90.90.0/24</span></code> or <code class="docutils literal notranslate"><span class="pre">fe80::/64</span></code>).</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">cephadm</span> <span class="pre">bootstrap</span></code> writes to <code class="docutils literal notranslate"><span class="pre">/etc/ceph</span></code> the files needed to access
the new cluster. This central location makes it possible for Ceph
packages installed on the host (e.g., packages that give access to the
cephadm command line interface) to find these files.</p>
<p>Daemon containers deployed with cephadm, however, do not need
<code class="docutils literal notranslate"><span class="pre">/etc/ceph</span></code> at all.  Use the <code class="docutils literal notranslate"><span class="pre">--output-dir</span> <span class="pre">*&lt;directory&gt;*</span></code> option
to put them in a different directory (for example, <code class="docutils literal notranslate"><span class="pre">.</span></code>). This may help
avoid conflicts with an existing Ceph configuration (cephadm or
otherwise) on the same host.</p>
</li>
<li><p>You can pass any initial Ceph configuration options to the new
cluster by putting them in a standard ini-style configuration file
and using the <code class="docutils literal notranslate"><span class="pre">--config</span> <span class="pre">*&lt;config-file&gt;*</span></code> option.  For example:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>cat &lt;&lt;EOF &gt; initial-ceph.conf
<span class="go">[global]</span>
<span class="go">osd crush chooseleaf type = 0</span>
<span class="go">EOF</span>
<span class="gp">$ </span>./cephadm bootstrap --config initial-ceph.conf ...
</pre></div>
</div>
</li>
<li><p>The <code class="docutils literal notranslate"><span class="pre">--ssh-user</span> <span class="pre">*&lt;user&gt;*</span></code> option makes it possible to choose which ssh
user cephadm will use to connect to hosts. The associated ssh key will be
added to <code class="docutils literal notranslate"><span class="pre">/home/*&lt;user&gt;*/.ssh/authorized_keys</span></code>. The user that you
designate with this option must have passwordless sudo access.</p></li>
<li><p>If you are using a container on an authenticated registry that requires
login, you may add the three arguments:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">--registry-json</span> <span class="pre">&lt;path</span> <span class="pre">to</span> <span class="pre">json</span> <span class="pre">file&gt;</span></code></p></li>
</ul>
<p>example contents of JSON file with login info:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">{&quot;url&quot;:&quot;REGISTRY_URL&quot;, &quot;username&quot;:&quot;REGISTRY_USERNAME&quot;, &quot;password&quot;:&quot;REGISTRY_PASSWORD&quot;}</span>
</pre></div>
</div>
<p>Cephadm will attempt to log in to this registry so it can pull your container
and then store the login info in its config database. Other hosts added to
the cluster will then also be able to make use of the authenticated registry.</p>
</li>
<li><p>See <a class="reference internal" href="#cephadm-deployment-scenarios"><span class="std std-ref">Different deployment scenarios</span></a> for additional examples for using <code class="docutils literal notranslate"><span class="pre">cephadm</span> <span class="pre">bootstrap</span></code>.</p></li>
</ul>
</div>
</div>
<div class="section" id="different-deployment-scenarios">
<span id="cephadm-enable-cli"></span><h2>Different deployment scenarios<a class="headerlink" href="#different-deployment-scenarios" title="Permalink to this headline">¶</a></h2>
<div class="section" id="single-host">
<h3>Single host<a class="headerlink" href="#single-host" title="Permalink to this headline">¶</a></h3>
<p>To configure a Ceph cluster to run on a single host, use the <code class="docutils literal notranslate"><span class="pre">--single-host-defaults</span></code> flag when bootstrapping.</p>
</div>
<div class="section" id="deployment-in-an-isolated-environment">
<h3>Deployment in an isolated environment<a class="headerlink" href="#deployment-in-an-isolated-environment" title="Permalink to this headline">¶</a></h3>
<p>You can install Cephadm in an isolated environment by using a custom container registry and configuring Docker to use an insecure registry. Ensure your container image is inside the registry and that you have access to all hosts you wish to add to the cluster. Currently, to add multiple hosts to a Ceph cluster in an isolated environment, you must use Docker. This may require you to uninstall Podman if it’s present on your host as Cephadm prefers to use Podman over Docker.</p>
<p>Run a local container registry:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">docker run --privileged -d --name registry -p <span class="m">5000</span>:5000 -v /var/lib/registry:/var/lib/registry --restart<span class="o">=</span>always registry:2</span>
</pre></div></div><p>Edit the <code class="docutils literal notranslate"><span class="pre">/etc/docker/daemon.json</span></code> file with the hostname and port where the registry is running:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="o">{</span> <span class="s2">&quot;insecure-registries&quot;</span>:<span class="o">[</span><span class="s2">&quot;*&lt;hostname&gt;*:5000&quot;</span><span class="o">]</span> <span class="o">}</span>
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>For every host which accesses the local registry, you will need to repeat this step and edit the <code class="docutils literal notranslate"><span class="pre">/etc/docker/daemon.json</span></code> file on the host.</p>
</div>
<p>Restart docker:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">systemctl daemon-reload</span>
<span class="prompt1">systemctl restart docker</span>
</pre></div></div><p>Next, push your container image to your local registry.</p>
<p>Then run bootstrap using the <code class="docutils literal notranslate"><span class="pre">--image</span></code> flag with your container image. For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">cephadm --image *&lt;hostname&gt;*:5000/ceph/ceph bootstrap --mon-ip *&lt;mon-ip&gt;*</span>
</pre></div></div></div>
</div>
<div class="section" id="enable-ceph-cli">
<h2>Enable Ceph CLI<a class="headerlink" href="#enable-ceph-cli" title="Permalink to this headline">¶</a></h2>
<p>Cephadm does not require any Ceph packages to be installed on the
host.  However, we recommend enabling easy access to the <code class="docutils literal notranslate"><span class="pre">ceph</span></code>
command.  There are several ways to do this:</p>
<ul>
<li><p>The <code class="docutils literal notranslate"><span class="pre">cephadm</span> <span class="pre">shell</span></code> command launches a bash shell in a container
with all of the Ceph packages installed. By default, if
configuration and keyring files are found in <code class="docutils literal notranslate"><span class="pre">/etc/ceph</span></code> on the
host, they are passed into the container environment so that the
shell is fully functional. Note that when executed on a MON host,
<code class="docutils literal notranslate"><span class="pre">cephadm</span> <span class="pre">shell</span></code> will infer the <code class="docutils literal notranslate"><span class="pre">config</span></code> from the MON container
instead of using the default configuration. If <code class="docutils literal notranslate"><span class="pre">--mount</span> <span class="pre">&lt;path&gt;</span></code>
is given, then the host <code class="docutils literal notranslate"><span class="pre">&lt;path&gt;</span></code> (file or directory) will appear
under <code class="docutils literal notranslate"><span class="pre">/mnt</span></code> inside the container:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">cephadm shell</span>
</pre></div></div></li>
<li><p>To execute <code class="docutils literal notranslate"><span class="pre">ceph</span></code> commands, you can also run commands like this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">cephadm shell -- ceph -s</span>
</pre></div></div></li>
<li><p>You can install the <code class="docutils literal notranslate"><span class="pre">ceph-common</span></code> package, which contains all of the
ceph commands, including <code class="docutils literal notranslate"><span class="pre">ceph</span></code>, <code class="docutils literal notranslate"><span class="pre">rbd</span></code>, <code class="docutils literal notranslate"><span class="pre">mount.ceph</span></code> (for mounting
CephFS file systems), etc.:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">cephadm add-repo --release pacific</span>
<span class="prompt1">cephadm install ceph-common</span>
</pre></div></div></li>
</ul>
<p>Confirm that the <code class="docutils literal notranslate"><span class="pre">ceph</span></code> command is accessible with:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph -v</span>
</pre></div></div><p>Confirm that the <code class="docutils literal notranslate"><span class="pre">ceph</span></code> command can connect to the cluster and also
its status with:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph status</span>
</pre></div></div></div>
<div class="section" id="adding-hosts">
<h2>Adding Hosts<a class="headerlink" href="#adding-hosts" title="Permalink to this headline">¶</a></h2>
<p>Next, add all hosts to the cluster by following <a class="reference internal" href="../host-management/#cephadm-adding-hosts"><span class="std std-ref">Adding Hosts</span></a>.</p>
<p>By default, a <code class="docutils literal notranslate"><span class="pre">ceph.conf</span></code> file and a copy of the <code class="docutils literal notranslate"><span class="pre">client.admin</span></code> keyring
are maintained in <code class="docutils literal notranslate"><span class="pre">/etc/ceph</span></code> on all hosts with the <code class="docutils literal notranslate"><span class="pre">_admin</span></code> label, which is initially
applied only to the bootstrap host. We usually recommend that one or more other hosts be
given the <code class="docutils literal notranslate"><span class="pre">_admin</span></code> label so that the Ceph CLI (e.g., via <code class="docutils literal notranslate"><span class="pre">cephadm</span> <span class="pre">shell</span></code>) is easily
accessible on multiple hosts.  To add the <code class="docutils literal notranslate"><span class="pre">_admin</span></code> label to additional host(s),</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph orch host label add *&lt;host&gt;* _admin</span>
</pre></div></div></div></blockquote>
</div>
<div class="section" id="adding-additional-mons">
<h2>Adding additional MONs<a class="headerlink" href="#adding-additional-mons" title="Permalink to this headline">¶</a></h2>
<p>A typical Ceph cluster has three or five monitor daemons spread
across different hosts.  We recommend deploying five
monitors if there are five or more nodes in your cluster.</p>
<p>Please follow <a class="reference internal" href="../services/mon/#deploy-additional-monitors"><span class="std std-ref">Deploying additional monitors</span></a> to deploy additional MONs.</p>
</div>
<div class="section" id="adding-storage">
<h2>Adding Storage<a class="headerlink" href="#adding-storage" title="Permalink to this headline">¶</a></h2>
<p>To add storage to the cluster, either tell Ceph to consume any
available and unused device:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph orch apply osd --all-available-devices</span>
</pre></div></div></div></blockquote>
<p>See <a class="reference internal" href="../services/osd/#cephadm-deploy-osds"><span class="std std-ref">Deploy OSDs</span></a> for more detailed instructions.</p>
<div class="section" id="enabling-osd-memory-autotuning">
<h3>Enabling OSD memory autotuning<a class="headerlink" href="#enabling-osd-memory-autotuning" title="Permalink to this headline">¶</a></h3>
<p>It is recommended to enable <code class="docutils literal notranslate"><span class="pre">osd_memory_target_autotune</span></code>.
in order to maximise the performance of the cluster. See <a class="reference internal" href="../services/osd/#osd-autotune"><span class="std std-ref">Automatically tuning OSD memory</span></a>.</p>
<p>In case the cluster hardware is not exclusively used by Ceph (hyperconverged),
reduce the memory consuption of Ceph like so:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1"><span class="c1"># hyperconverged only:</span></span>
<span class="prompt1">ceph config <span class="nb">set</span> mgr mgr/cephadm/autotune_memory_target_ratio <span class="m">0</span>.2</span>
</pre></div></div></div></blockquote>
<p>Then enable memory autotuning:</p>
<blockquote>
<div><div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph config <span class="nb">set</span> osd osd_memory_target_autotune <span class="nb">true</span></span>
</pre></div></div></div></blockquote>
</div>
</div>
<div class="section" id="using-ceph">
<h2>Using Ceph<a class="headerlink" href="#using-ceph" title="Permalink to this headline">¶</a></h2>
<p>To use the <em>Ceph Filesystem</em>, follow <a class="reference internal" href="../services/mds/#orchestrator-cli-cephfs"><span class="std std-ref">Deploy CephFS</span></a>.</p>
<p>To use the <em>Ceph Object Gateway</em>, follow <a class="reference internal" href="../services/rgw/#cephadm-deploy-rgw"><span class="std std-ref">Deploy RGWs</span></a>.</p>
<p>To use <em>NFS</em>, follow <a class="reference internal" href="../services/nfs/#deploy-cephadm-nfs-ganesha"><span class="std std-ref">NFS Service</span></a></p>
<p>To use <em>iSCSI</em>, follow <a class="reference internal" href="../services/iscsi/#cephadm-iscsi"><span class="std std-ref">Deploying iSCSI</span></a></p>
</div>
<div class="section" id="cephadm-deployment-scenarios">
<span id="id2"></span><h2>Different deployment scenarios<a class="headerlink" href="#cephadm-deployment-scenarios" title="Permalink to this headline">¶</a></h2>
<div class="section" id="id3">
<h3>Single host<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h3>
<p>To configure a Ceph cluster to run on a single host, use the <code class="docutils literal notranslate"><span class="pre">--single-host-defaults</span></code> flag when bootstrapping. For use cases of this, see <a class="reference internal" href="../../rados/troubleshooting/troubleshooting-pg/#one-node-cluster"><span class="std std-ref">单节点集群</span></a>.</p>
<p>The <code class="docutils literal notranslate"><span class="pre">--single-host-defaults</span></code> flag sets the following configuration options:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">global/osd_crush_choose_leaf_type = 0</span>
<span class="go">global/osd_pool_default_size = 2</span>
<span class="go">mgr/mgr_standby_modules = False</span>
</pre></div>
</div>
<p>For more information on these options, see <a class="reference internal" href="../../rados/troubleshooting/troubleshooting-pg/#one-node-cluster"><span class="std std-ref">单节点集群</span></a> and <code class="docutils literal notranslate"><span class="pre">mgr_standby_modules</span></code> in <a class="reference internal" href="../../mgr/administrator/#mgr-administrator-guide"><span class="std std-ref">ceph-mgr 管理员指南</span></a>.</p>
</div>
<div class="section" id="id4">
<h3>Deployment in an isolated environment<a class="headerlink" href="#id4" title="Permalink to this headline">¶</a></h3>
<p>You can install Cephadm in an isolated environment by using a custom container registry. You can either configure Podman or Docker to use an insecure registry, or make the registry secure. Ensure your container image is inside the registry and that you have access to all hosts you wish to add to the cluster.</p>
<p>Run a local container registry:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">podman run --privileged -d --name registry -p <span class="m">5000</span>:5000 -v /var/lib/registry:/var/lib/registry --restart<span class="o">=</span>always registry:2</span>
</pre></div></div><p>If you are using an insecure registry, configure Podman or Docker with the hostname and port where the registry is running.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>For every host which accesses the local insecure registry, you will need to repeat this step on the host.</p>
</div>
<p>Next, push your container image to your local registry.</p>
<p>Then run bootstrap using the <code class="docutils literal notranslate"><span class="pre">--image</span></code> flag with your container image. For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">cephadm --image *&lt;hostname&gt;*:5000/ceph/ceph bootstrap --mon-ip *&lt;mon-ip&gt;*</span>
</pre></div></div></div>
</div>
</div>



           </div>
           
          </div>
          <footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
        <a href="../adoption/" class="btn btn-neutral float-right" title="现有集群切换到 cephadm" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
        <a href="../compatibility/" class="btn btn-neutral float-left" title="Compatibility and Stability" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).

    </p>
  </div> 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>